package com.kizuki.design.chain2;

import java.util.Objects;

public abstract class AbstractHandler {

    public void handle(PeopleContent peopleContent){
        if (Objects.isNull(peopleContent)) {
            return;
        }
        SexEnum sexEnum = SexEnum.getSexEnum(peopleContent.getSexId());
        if (support(sexEnum)) {
            doHandle(peopleContent);
        }
    }

    protected abstract void doHandle(PeopleContent peopleContent);

    protected abstract boolean support(SexEnum sexEnum);
}
